package de.baumann.browser.views.dialog

import android.content.Context
import android.widget.Toast
import de.baumann.browser.R
import kotlinx.android.synthetic.main.dialog_wallet_password.*

class WalletPasswordDailog (context: Context,var callback:Callback):BaseDialog(context){
    override fun laoutId(): Int {
        return R.layout.dialog_wallet_password
    }

    override fun initView() {
        btnWPC.setOnClickListener {
            dismiss()
        }
        btnWPO.setOnClickListener {
            if (getWPP().isEmpty()){
                Toast.makeText(mContext,"请输入密码",Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
            callback.password(getWPP())
            dismiss()
        }
    }

    private fun getWPP():String{
        return edWalletPassword.text.toString().trim()
    }

    public interface Callback{
        fun password(password:String)
    }

}